<template>
    <div>
        <detail-banner :sightName="sightName" :imgs="imgs"></detail-banner>
        <detail-header></detail-header>

        <div class="content">
            <detail-list :list="list"></detail-list>
        </div>
    </div>
</template>

<script>
    import DetailBanner from './components/Banner'
    import DetailHeader from './components/Header'
    import DetailList from './components/List'
    import axios from 'axios'
    export default {
        name: "Detail",
        components: {
            DetailBanner, DetailHeader, DetailList
        },
        data() {
            return {
                list: [],
                sightName:'',
                imgs:[],
                id:0
            }
        },
        methods:{
            getDetailInfo () {
                axios.get('/api/detail.json',{
                    params:{
                        id:this.$route.params.id

                    }

                })
                    .then((res)=>{
                        console.log(res.data);
                        this.list = res.data.data.categoryList;
                        this.sightName = res.data.data.sightName;
                        this.imgs = res.data.data.gallaryImgs;
                        // console.log(this.sightName)
                        this.id = this.$route.params.id
                    })
            },
        },
        mounted(){
            this.getDetailInfo()
        },
        activated () {
            if (this.$route.params.id !== id){
                alert(this.$route.params.id);
                this.id = this.$route.params.id;
                this.getDetailInfo()
            }
        }
    }
</script>

<style scoped lang="stylus">
    .content
        height:50rem
</style>
